package com.handsome.组合模式;

/**
 * 组织
 * 抽象类
 * @author niechun
 * @date 2023/3/1 20:14
 */
public abstract class OrganizationComponent {
    private String name;
    private String description;

    public abstract void print();

    protected void add(OrganizationComponent organizationComponent){
     //默认实现 因为叶子节点可能不需要这个方法
     throw new UnsupportedOperationException();
    }

    protected void remove(OrganizationComponent organizationComponent){
        //默认实现 因为叶子节点可能不需要这个方法
        throw new UnsupportedOperationException();
    }

    public OrganizationComponent(String name, String description) {
        this.name = name;
        this.description = description;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
